package com.hc.demo.controller;

import com.hc.demo.domain.Hospital;
import com.hc.demo.dto.ResultResponse;
import com.hc.demo.service.HospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HospitalController {

    @Autowired
    HospitalService hospitalService;

    @RequestMapping("/listHospital")
    public ResultResponse listHospital(){
        return hospitalService.list();
    }

    @RequestMapping("/getHospitalById")
    public ResultResponse getHospitalById(@RequestBody Hospital hospital){
        return hospitalService.selectOneById(hospital.getHpId());
    }

}
